package com.airsystem.pos.bengkel.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.ForeignKey;

/**
 * @author Budi Oktaviyan <budi.oktaviyan@icloud.com>
 */

@Entity
@Table(name = "tbl_detail_pelanggan")
public class DetailPelanggan implements Serializable {

	@Id
	@GeneratedValue
	private Long id;

	@ManyToOne
	@ForeignKey(name = "FK_PELANGGAN")
	private Pelanggan pelanggan;

	@ManyToOne
	@JoinColumn(name = "detail_kendaraan", nullable = false)
	@ForeignKey(name = "FK_PELANGGAN_KENDARAAN")
	private DetailKendaraan detail_kendaraan;

	@OneToMany(mappedBy = "detail_pelanggan", fetch = FetchType.LAZY)
	private Set<OrderLayanan> order_layanan = new HashSet<OrderLayanan>(0);

	private String tahun;
	private String nopol;
	private String norangka;
	private String nomesin;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Pelanggan getPelanggan() {
		return pelanggan;
	}

	public void setPelanggan(Pelanggan pelanggan) {
		this.pelanggan = pelanggan;
	}

	public DetailKendaraan getDetail_kendaraan() {
		return detail_kendaraan;
	}

	public void setDetail_kendaraan(DetailKendaraan detail_kendaraan) {
		this.detail_kendaraan = detail_kendaraan;
	}

	public Set<OrderLayanan> getOrder_layanan() {
		return order_layanan;
	}

	public void setOrder_layanan(Set<OrderLayanan> order_layanan) {
		this.order_layanan = order_layanan;
	}

	public String getTahun() {
		return tahun;
	}

	public void setTahun(String tahun) {
		this.tahun = tahun;
	}

	public String getNopol() {
		return nopol;
	}

	public void setNopol(String nopol) {
		this.nopol = nopol;
	}

	public String getNorangka() {
		return norangka;
	}

	public void setNorangka(String norangka) {
		this.norangka = norangka;
	}

	public String getNomesin() {
		return nomesin;
	}

	public void setNomesin(String nomesin) {
		this.nomesin = nomesin;
	}
}